﻿<!-- saved from url=(0022)http://internet.e-mail -->
<?xml version="1.0" encoding="UTF-8" ?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
<title>藏边旅行网_iframe自适应高宽</title>
<script type="text/javascript" src="/html/js/jquery-1.4.2.js"></script>
<style>
	*{margin:0;padding:0;}
	html{
		overflow:hidden;
	}
	body{
		font-family:"Verdana","宋体";
		font-size:12px;	
	}	
	.shortcut{
		height:42px;
		width:100%;
		position:relative;
		background-color: rgb(43,91,148);
	}
	#mainIframe{
		border:2px red solid;
	}
</style>
<script type="text/javascript" >
	$(function(){		
		autoIframeHeight();
		$(window).resize(function(){
			autoIframeHeight();
		});
	});
	
	function autoIframeHeight(){
		var width = $(window).width();
		var height = $(window).height();
		
		var mainIframe = document.getElementById("mainIframe"); //作为一个jQuery元素
		var mainIframeJ = $("#mainIframe")[0]; //作为一个普通的DOM元素
		var mainIframew = window.frames['mainIframe'];//作为一个BOM对象，window
	
		iWidth = width-20;
		iHeight = height - 42-20;
		$("#mainIframe").attr("width",iWidth+"px");
		$("#mainIframe").attr("height",iHeight+"px");
		
	}
</script>
</head>
<body>
	<div class="shortcut">	
		<div>父页面元素:<h1>请缩放窗口以示效果</h1></div>
		<div><span id="logger"></span></div>
	</div>

	<iframe id="mainIframe" name="mainIframe" src="http://www.baidu.com" frameborder="0" scrolling="auto" ></iframe>

<script type="text/javascript" >
	var logger = new function(){
		this.log = function(obj,isNewLine){
			var oldS = $("#logger").html();
			var s;
			if(typeof isNewLine !='undefined' && isNewLine==true){
				s = oldS + "</br>" + obj['key'] + ":"+obj['value'];
			}else{
				s = oldS + " " + obj['key'] + ":" + obj['value'];
			}
			$("#logger").html(s);
		};
		this.clear = function(){
			$("#logger").html("");
		}
		this.hr = function(){
			var hr = "<div style='border-bottom:1px blue solid;margin-top:1px;'></div>"
			var oldS = $("#logger").html();
			var s = oldS + hr;
			$("#logger").html(s);
		}
		
	}();
</script>
<script type="text/javascript">
var _bdhmProtocol = (("https:" == document.location.protocol) ? " https://" : " http://");
document.write(unescape("%3Cscript src='" + _bdhmProtocol + "hm.baidu.com/h.js%3F981a4babede43d4b65dfce905038f9b5' type='text/javascript'%3E%3C/script%3E"));

</script>
<script>
	$(function(){
		$("a[href*=tongji]").hide();
	});
</script>
</body>
</html>